#!/bin/bash
# postrm script for jitsi-videobridge

set -e

# Load debconf
. /usr/share/debconf/confmodule


case "$1" in
    purge)

        # Clear the debconf variable
        db_purge

        # and then remove the user
        if getent passwd jvb > /dev/null ; then
            deluser jvb
        fi

        # clear logs
        if [ -d "/var/log/jitsi" ]; then
            rm -rf "/var/log/jitsi"
        fi

        rm -f /etc/jitsi/videobridge/config
        rm -f /etc/jitsi/videobridge/sip-communicator.properties
        rm -f /etc/jitsi/videobridge/logging.properties
        rm -rf /usr/share/jitsi-videobridge/.java
        rm -rf /usr/share/jitsi-videobridge/.sip-communicator
    ;;

    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

db_stop

exit 0
